package com.cms.controller.admin;

import com.cms.CommonAttribute;
import com.cms.entity.Log;
import com.cms.entity.Member;
import com.cms.entity.Money;
import com.cms.routes.RouteMapping;

/**
 * @author ：chenxf
 * @date ：Created in 2019/8/5 16:38
 * @description：资金
 * @modified By：
 * @version: $
 */
@RouteMapping(url = "/admin/money")

public class MoneyController  extends BaseController{

    /**
     * 列表
     */
    public void money(){
        String mobile = getPara("mobile");
        Integer pageNumber = getParaToInt("pageNumber");
        if(pageNumber==null){
            pageNumber = 1;
        }
        setAttr("page", new Money().dao().findPage(mobile,pageNumber,PAGE_SIZE));
        setAttr("mobile", mobile);
        render(getView("money/money"));
    }

    /**
     * 列表
     */
    public void log(){
        String mobile = getPara("mobile");
        Integer pageNumber = getParaToInt("pageNumber");
        if(pageNumber==null){
            pageNumber = 1;
        }
        setAttr("page", new Log().dao().findPage(mobile,"",pageNumber,PAGE_SIZE));
        setAttr("mobile", mobile);
        render(getView("money/log"));
    }

    /**
     * 列表
     */
    public void tx(){
        String mobile = getPara("mobile");
        Integer pageNumber = getParaToInt("pageNumber");
        if(pageNumber==null){
            pageNumber = 1;
        }
        setAttr("page", new Log().dao().findPage(mobile, CommonAttribute.CASHAPPLY,pageNumber,PAGE_SIZE,"1"));
        setAttr("mobile", mobile);
        render(getView("money/cash"));
    }

    /**
     * 提现结果
     */
    public void txResult(){
        Long id = getParaToLong("id");
        String status = getPara("status");
       new Money().dao().cashResult(id,status);

        redirect("/admin/money/tx");
    }
}
